<template>
  <div>
    <h1 v-text="childData"></h1>
    <button type="button" @click="getMsg">子组件获取父组件消息按钮</button>
    父组件消息 >>> <span v-text="parentMsg"></span>
  </div>
  <hr style="width: 50%">
</template>

<script>
export default {
  name: "LhzE",
  data() {
    return {
      childData: "子组件数据",
      childMsg: '子组件消息',
      parentMsg: ''
    }
  },
  methods: {
    getMsg() {
      // console.log(this.$parent);
      // console.log(this.$root.$refs.helloLhz.parentMsg);
      this.parentMsg = this.$root.$refs.helloLhz.parentMsg;
    }
  },


}
</script>

<style scoped>

</style>